#ifndef ANATOMICALLINK_H
#define ANATOMICALLINK_H

#include <QObject>
#include <vtkRenderer.h>
#include <vtkActor.h>
#include <vtkPolyDataMapper.h>
#include <anatomicalregion.h>
#include <vtkLineSource.h>
#include <vtkTubeFilter.h>
#include <QColor>
#include <colormap.h>
//#include <utils.h>

inline int min(double nX, double nY)
{
    return nX > nY ? nY : nX;
}

class AnatomicalLink : public QObject
{
public:
    AnatomicalLink(AnatomicalRegion *regA, AnatomicalRegion *regB, double corr);
    //AnatomicalLink(const AnatomicalLink &link);
    //AnatomicalLink& operator=(const AnatomicalLink& rhs);
    bool operator==(AnatomicalLink aLink);
    ~AnatomicalLink();

    AnatomicalRegion* regionA();
    AnatomicalRegion* regionB();

    void setCorrelation(double corr);
    void setColor(const double* &col);
    void setVisible(bool visible);
	void setEnabled(bool enable);

    double correlation() const;
	double distance();
	bool isEnabled();
	bool isSymmetry();

    void attachToRenderer(vtkRenderer* renderer);
    void detachFromRenderer(vtkRenderer* renderer);

    bool equals(AnatomicalLink *other);

private:
    void init();

	bool enabled;
    double corr;
	double dist;
    double color[3];
    vtkActor *actor;
    vtkPolyDataMapper *mapper;
	vtkTubeFilter *tubeFilt;
    AnatomicalRegion *regA;
    AnatomicalRegion *regB;
};

#endif // ANATOMICALLINK_H
